package org.jeecg.modules.util;


import org.xm.Similarity;

public class TextSimilarityDemo {

    public static void main(String[] args) {
        String sentence1 = "中国人爱吃鱼";
        String sentence2 = "湖北佬最喜吃鱼";

        //形态相似性
        double morphoSimilarityResult = Similarity.morphoSimilarity(sentence1, sentence2);
        //距离相似性
        double editDistanceResult = Similarity.editDistanceSimilarity(sentence1, sentence2);
        //编辑距离相似性
        double standEditDistanceResult = Similarity.standardEditDistanceSimilarity(sentence1,sentence2);
        double gregeorEditDistanceResult = Similarity.gregorEditDistanceSimilarity(sentence1,sentence2);
        double phraseSimilarityResult = Similarity.phraseSimilarity(sentence1, sentence2);

        System.out.println(sentence1 + " vs " + sentence2 + " 词形词序句子相似度值：" + morphoSimilarityResult);
        System.out.println(sentence1 + " vs " + sentence2 + " 优化的编辑距离句子相似度值：" + editDistanceResult);
        System.out.println(sentence1 + " vs " + sentence2 + " 标准编辑距离句子相似度值：" + standEditDistanceResult);
        System.out.println(sentence1 + " vs " + sentence2 + " gregeor编辑距离句子相似度值：" + gregeorEditDistanceResult);
        System.out.println(sentence1 + " vs " + sentence2 + " 短语相似度值：" + phraseSimilarityResult);
    }

}
